﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ChoViet.CMS.ViewModels.AreaIndexViewModel>" %>
<%@ Import Namespace="ChoViet.Lib.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Khu vực
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Header" runat="server">
	Khu vực
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%> 
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Toolbar" runat="server">
	<%= Html.Toolbar("Thêm mới", "/Area/CreateCms/", "new")%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%if(ViewData["MessageInfo"]==null){ %>
	<form action="/Area/IndexCms" method="post" name="adminForm">
		<table width="100%" class="adminlist">
			<tr>
				<th width="30" align="right"><%= Html.Sort("ID", "ID", ViewData["orderDir"].ToString(), ViewData["order"].ToString())%></th>
				<th width="30"></th>
				<th width="30"></th>
				<th>
					<%= Html.Sort("Tên khu vực", "Name", ViewData["orderDir"].ToString(), ViewData["order"].ToString())%>
				</th>				
			</tr>
		<% 
    		foreach (var item in Model.Areas) {
		%>		
			<tr id="tr_<%= item.ID %>">
				<td align="center">
					<%= item.ID %>
				</td>
				<td align="center">
					<%= Html.ActionImage("Sửa", "icon-24-edit.png", "Area", "EditCms", new Dictionary<string, object>() { { "id", Convert.ToInt32(item.ID) } })%>
				</td>
				 <td align="center">
					<img alt="Xóa giá trị" src="/Images/icon-24-delete.png" onclick="DelArea(<%=item.ID %>);" />
				</td>
				<td>
				    <span class="lightLale"> <%=Html.Encode(item.Name) %></span>
				    <%foreach (var it in item.Cities)
                      {%>
                        <div class="listCities"><%=it.ID%>:<%=it.Name%></div>                
                      <%} %>    
				</td>
			</tr>
	    
		<% } %>

		</table>
		<%= Html.Hidden("order")%>
		<%= Html.Hidden("orderDir")%>
	</form>
<% } %>
<script type="text/javascript">
    function DelArea(id) {
        Del(id, 'Area');
    }    
</script>
</asp:Content>
